"""
pip install pymysql
"""

from pymysql import Connection

# 获取Mysql数据库连接对象
conn = Connection(host="localhost", port=3306, user="root", password="password")

# 获取游标对象
cursor = conn.cursor()
# 选择数据库
conn.select_db("mytest")
# 使用游标对象执行sql语句
cursor.execute("CREATE TABLE test_pymysql(id INT, info VARCHAR(255))")
# 关闭连接
conn.close()
